package util;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created by uu on 2017/6/19.
 */
public class Conn {
    public Connection getConnection() throws Exception{
        ConnectionFactory factory =  new ConnectionFactory();
                /*factory.setUri("amqp://userName:password@hostName:portNumber/virtualHost");*/
        factory.setUsername("alert_user");
        factory.setPassword("alertme");
        factory.setVirtualHost("/");
        factory.setHost("localhost");
        factory.setPort(5672);
        Connection conn = factory.newConnection();
        return conn;
    }
}
